Skip to content

Enable per-region CMA DMA-BUF heaps for audio ML offload#839

Open
qti-sbojja wants to merge 3 commits into
qualcomm-linux:qcom-6.18.yfrom
qti-sbojja:dma_support
Open

Enable per-region CMA DMA-BUF heaps for audio ML offload#839
qti-sbojja wants to merge 3 commits into
qualcomm-linux:qcom-6.18.yfrom
qti-sbojja:dma_support

Conversation

@qti-sbojja

@qti-sbojja qti-sbojja commented Jul 17, 2026

Copy link
Copy Markdown

Backports the upstream per-region CMA DMA-BUF heap support (heap registration rework + one heap per CMA reserved region) and enables CONFIG_DMA_CMA in qcom.config so the DMA-BUF heap configs can be selected. Enables allocating from a dedicated CMA region for the audio ML offload use case.

CRs-Fixed: 4613255

Maxime Ripard (mripard) and others added 3 commits July 18, 2026 11:22
The CMA heap instantiation was initially developed by having the
contiguous DMA code call into the CMA heap to create a new instance
every time a reserved memory area is probed.

Turning the CMA heap into a module would create a dependency of the
kernel on a module, which doesn't work.

Let's turn the logic around and do the opposite: store all the reserved
memory CMA regions into the contiguous DMA code, and provide an iterator
for the heap to use when it probes.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/20260331-dma-buf-heaps-as-modules-v4-1-e18fda504419@kernel.org
…egion

Aside from the main CMA region, it can be useful to allow userspace to
allocate from the other CMA reserved regions.

Indeed, those regions can have specific properties that can be useful to
a specific us-case.

For example, one of them platform I've been with has ECC enabled on the
entire memory but for a specific region. Using that region to allocate
framebuffers can be particular beneficial because enabling the ECC has a
performance and memory footprint cost.

Thus, exposing these regions as heaps user-space can allocate from and
import wherever needed allows to cover that use-case.

For now, only shared-dma-pools regions with the reusable property (ie,
backed by CMA) are supported, but eventually we'll want to support other
DMA pools types.

Since we collected all the CMA regions created during boot, we can
simply iterate over all of them to create the heaps.

This has a weird interaction with the recent work on the CMA name, in
particular the backward compatibility code created by commit
854acbe ("dma-buf: heaps: Give default CMA heap a fixed name").

Indeed, the old name was either 'reserved', or the name of the
reserved-memory region device tree node if the linux,cma-default
property was set.

In both these cases, we have now collected this region during boot, and
we're using the same name. So we're now largely redundant with the
code to handle backward compatibility code, and we can thus remove it
and the associated Kconfig option.

Reviewed-by: T.J. Mercier <tjmercier@google.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://lore.kernel.org/r/20251013-dma-buf-ecc-heap-v8-5-04ce150ea3d9@kernel.org
Enable CONFIG_DMA_CMA as a dependency to allow the DMA-BUF heap
configs (DMABUF_HEAPS, DMABUF_HEAPS_CMA, DMABUF_HEAPS_SYSTEM) to
be selected in qcom.config.

Link: qualcomm-linux/kernel-topics#1452
Signed-off-by: Bibek Kumar Patro <bibek.patro@oss.qualcomm.com>
@qlijarvis

Copy link
Copy Markdown

PR #839 — validate-patch

PR: #839

Verdict Issues Detailed Report
0 Full report

Final Summary

  1. Lore link present: Not provided in agent output
  2. Lore link matches PR commits: Not provided in agent output
  3. Upstream patch status: Not provided in agent output
  4. PR present in qcom-next/topics: Partial - 2/3 commit(s) only have partial integration evidence
Verdict: ❌ — click to expand

🔍 Patch Validation

PR: #839
Verdict: ❌ FAIL

This PR contains 3 commits. Validation results for each:


Commit 1/3: FROMGIT: dma: contiguous: Turn heap registration logic around

Upstream: https://lore.kernel.org/r/20260331-dma-buf-heaps-as-modules-v4-1-e18fda504419@kernel.org
Verdict: ❌ FAIL

Commit Message

Check Status Note
Subject matches upstream Subject identical (FROMGIT prefix added)
Body preserves rationale Full commit message preserved
Fixes tag present/correct N/A No Fixes tag in upstream
Authorship preserved From: Maxime Ripard matches lore author
Backport note N/A FROMGIT commit, not a backport

Diff

File Status Notes
include/linux/dma-map-ops.h ⚠️ Present in both PR and lore
kernel/dma/contiguous.c ⚠️ Present in both PR and lore
drivers/dma-buf/heaps/cma_heap.c Missing from PR — present in lore patch
include/linux/dma-buf/heaps/cma.h Missing from PR — deleted in lore patch

Issues

  1. Incomplete patch: The PR contains only 2 of 4 files from the upstream patch. The lore patch modifies/deletes:

    • drivers/dma-buf/heaps/cma_heap.c (modified) — missing from PR
    • include/linux/dma-buf/heaps/cma.h (deleted) — missing from PR
    • include/linux/dma-map-ops.h (modified) — present in PR
    • kernel/dma/contiguous.c (modified) — present in PR
  2. Semantic incompleteness: The upstream patch refactors the CMA heap registration by moving logic from drivers/dma-buf/heaps/cma_heap.c to kernel/dma/contiguous.c and removing the old interface header include/linux/dma-buf/heaps/cma.h. The PR only includes the kernel/dma side of this refactor, leaving the heap driver side unchanged. This creates an inconsistent state where the new API is defined but the old call sites remain.

Upstream Patch Status

ACKed — Applied to dma-mapping-for-next branch (patches 1-5 of the series). Maintainer Marek Szyprowski confirmed: "Applied again patches 1-5 to my dma-mapping-for-next branch."

qcom-next Presence

⚠️ Partial — Integration report shows "partial - subject or partial tree evidence found, but full change was not verified"

Verdict

REJECT — This commit is incomplete. It must include all 4 files from the upstream patch to maintain semantic correctness. The missing changes to drivers/dma-buf/heaps/cma_heap.c and deletion of include/linux/dma-buf/heaps/cma.h are essential to the refactor.


Commit 2/3: FROMGIT: dma-buf: heaps: cma: Create CMA heap for each CMA reserved region

Upstream: https://lore.kernel.org/r/20251013-dma-buf-ecc-heap-v8-5-04ce150ea3d9@kernel.org
Verdict: ❌ FAIL

Commit Message

Check Status Note
Subject matches upstream Subject identical (FROMGIT prefix added)
Body preserves rationale Full commit message preserved
Fixes tag present/correct N/A No Fixes tag in upstream
Authorship preserved From: Maxime Ripard matches lore author
Backport note N/A FROMGIT commit, not a backport

Diff

File Status Notes
drivers/dma-buf/heaps/cma_heap.c ⚠️ Present in both PR and lore
Documentation/userspace-api/dma-buf-heaps.rst Missing from PR — present in lore patch
drivers/dma-buf/heaps/Kconfig Missing from PR — present in lore patch

Issues

  1. Incomplete patch: The PR contains only 1 of 3 files from the upstream patch. The lore patch modifies:

    • Documentation/userspace-api/dma-buf-heaps.rst (modified) — missing from PR
    • drivers/dma-buf/heaps/Kconfig (modified) — missing from PR
    • drivers/dma-buf/heaps/cma_heap.c (modified) — present in PR
  2. Missing documentation and Kconfig changes: The upstream patch removes the DMABUF_HEAPS_CMA_LEGACY_NAME Kconfig option and updates the user-facing documentation to reflect the new behavior. These changes are essential for users and maintainers to understand the new heap naming scheme.

Upstream Patch Status

ACKed — Merged to drm-misc-next. Maintainer Sumit Semwal confirmed: "Thank you; it's merged to drm-misc-next now." The patch received Reviewed-by from T.J. Mercier and Acked-by from Marek Szyprowski.

qcom-next Presence

⚠️ Partial — Integration report shows "partial - subject or partial tree evidence found, but full change was not verified"

Verdict

REJECT — This commit is incomplete. It must include all 3 files from the upstream patch, including the documentation and Kconfig changes that are part of the upstream commit.


Commit 3/3: QCLINUX: qcom.config: Enable DMA_CMA for DMA-BUF heap support

Upstream: N/A (vendor-only commit)
Verdict: ✅ PASS

Commit Message

Check Status Note
Subject format QCLINUX prefix correct for vendor-only change
Body preserves rationale Clear explanation of config dependency
Fixes tag present/correct N/A Not applicable for config change
Authorship From: Bibek Kumar Patro
Link tag Links to kernel-topics PR #1452

Diff

File Status Notes
arch/arm64/configs/qcom.config Adds CONFIG_DMA_CMA=y as dependency

Issues

None — this is a clean vendor-only config change.

qcom-next Presence

Present — Integration report shows "present - exact patch-id match at 2f8abb9"

Verdict

PASS — This vendor-only commit is correctly formatted and already present in qcom-next.


Final Summary

  1. Lore link present: Yes for commits 1/3 and 2/3 (FROMGIT); No for commit 3/3 (QCLINUX vendor-only, no lore link expected)

  2. Lore link matches PR commits: No — Both FROMGIT commits (1/3 and 2/3) are incomplete:

    • Commit 1/3 missing 2 of 4 files (drivers/dma-buf/heaps/cma_heap.c and include/linux/dma-buf/heaps/cma.h)
    • Commit 2/3 missing 2 of 3 files (Documentation/userspace-api/dma-buf-heaps.rst and drivers/dma-buf/heaps/Kconfig)
  3. Upstream patch status:

    • Commit 1/3: ✅ ACKed — Applied to dma-mapping-for-next
    • Commit 2/3: ✅ ACKed — Merged to drm-misc-next
    • Commit 3/3: N/A — vendor-only change, not posted upstream
  4. PR present in qcom-next/topics:

    • Commit 1/3: Partial (incomplete integration)
    • Commit 2/3: Partial (incomplete integration)
    • Commit 3/3: Present (exact match at 2f8abb9)
    • Overall: Partial — 2/3 commits only have partial integration evidence

Recommendation

DO NOT MERGE — Commits 1/3 and 2/3 must be corrected to include all files from their respective upstream patches before merging:

Required fixes:

  1. Commit 1/3 must include:

    • Changes to drivers/dma-buf/heaps/cma_heap.c (removes old registration code, uses new iterator)
    • Deletion of include/linux/dma-buf/heaps/cma.h (old interface header)
  2. Commit 2/3 must include:

    • Changes to Documentation/userspace-api/dma-buf-heaps.rst (documents new heap naming)
    • Changes to drivers/dma-buf/heaps/Kconfig (removes DMABUF_HEAPS_CMA_LEGACY_NAME option)

Why this matters: These are not optional documentation or cleanup changes — they are integral parts of the upstream commits. Cherry-picking only the code changes while omitting documentation, Kconfig, and complementary code changes creates an inconsistent state that diverges from upstream and may cause build failures, runtime issues, or confusion for future maintainers.

Next steps:

  1. Fetch the complete upstream patches using b4 am <message-id>
  2. Apply the full patches (all files) to the PR branch
  3. Re-submit the PR with complete commits

Deterministic Integration Presence

Integration Presence Report

This report is generated by Jarvis before validate-patch runs.
It is the authoritative source for whether PR changes are already present
in qcom-next or in the kernel topic branches.

Kernel repo: /local/mnt/workspace/sgaud/Qgenie/image_pipeline/kernel
qcom-next ref: a5cf3debd8c3c660711ad586ad4bb84e9ca42635
topics remote: topics -> https://github.com/qualcomm-linux/kernel-topics
topics fetch: fetched

Commit Subject qcom-next topics Final
1/3 [PATCH 1/3] FROMGIT: dma: contiguous: Turn heap registration logic partial - subject or partial tree evidence found, but full change was not verified partial - subject or partial tree evidence found, but full change was not verified partial
2/3 [PATCH 2/3] FROMGIT: dma-buf: heaps: cma: Create CMA heap for each partial - subject or partial tree evidence found, but full change was not verified partial - subject or partial tree evidence found, but full change was not verified partial
3/3 [PATCH 3/3] QCLINUX: qcom.config: Enable DMA_CMA for DMA-BUF heap present - exact patch-id match at 2f8abb9 skipped - not checked because qcom-next already contains the change present

Final Status

overall_status: PARTIAL
present_commits: 1/3
partial_commits: 2/3
missing_commits: 0/3
topics_checked_for_commits: 2/3
final_summary: PR present in qcom-next/topics: Partial - 2/3 commit(s) only have partial integration evidence

@qlijarvis

Copy link
Copy Markdown

PR #839 — checker-log-analyzer

PR: #839
Checker run: https://github.com/qualcomm-linux/kernel-config/actions/runs/29633063913

Checker Result Summary
Checker Result Summary
checkpatch All commits passed style checks
dt-binding-check ⏭️ No DT binding changes
dtb-check ⏭️ No devicetree changes
sparse-check Passed (pre-existing DRM errors unrelated to PR)
check-uapi-headers No UAPI changes
check-patch-compliance 3 failures: 2 content mismatches, 1 invalid prefix
tag-check ⚠️ Cannot determine target branch (network restricted)

Detailed report: Full report

Checker analysis — click to expand

🤖 CI Checker Analysis (checker-log-analyzer)

PR: #839 - Enable DMA_CMA for DMA-BUF heap support
Source: https://github.com/qualcomm-linux/kernel-config/actions/runs/29633063913

Checker Result Summary
checkpatch All commits passed style checks
dt-binding-check ⏭️ No DT binding changes
dtb-check ⏭️ No devicetree changes
sparse-check Passed (pre-existing DRM errors unrelated to PR)
check-uapi-headers No UAPI changes
check-patch-compliance 3 failures: 2 content mismatches, 1 invalid prefix
tag-check ⚠️ Cannot determine target branch (network restricted)

❌ check-patch-compliance

Root cause: Three distinct failures across all three commits in the PR.

Failure 1: Commit 1 - Content mismatch

Commit: b6ccf10f7c65 - "FROMGIT: dma: contiguous: Turn heap registration logic around"

Failure details:

Checking commit: FROMGIT: dma: contiguous: Turn heap registration logic around
Change is different from the one mentioned in Link

Link in commit: https://lore.kernel.org/r/20260331-dma-buf-heaps-as-modules-v4-1-e18fda504419@kernel.org

Analysis: The checker detected that the patch content differs from the upstream version at the provided lore link. This could be due to:

  • Context line differences (false positive)
  • Legitimate backport adaptations
  • Missing or extra hunks

Fix:

# Fetch the upstream patch
b4 am --single-message -C -l -3 https://lore.kernel.org/r/20260331-dma-buf-heaps-as-modules-v4-1-e18fda504419@kernel.org -o /tmp/upstream

# Compare the actual changes (+ and - lines only)
git format-patch -1 b6ccf10f7c65 --stdout | awk '/^diff/,/^--$/' | grep -E '^[+-][^+-]' > /tmp/pr-changes
awk '/^diff/,/^--$/' /tmp/upstream/*.mbx | grep -E '^[+-][^+-]' > /tmp/upstream-changes
diff /tmp/pr-changes /tmp/upstream-changes

# If differences are legitimate adaptations, document them in the commit message:
git commit --amend
# Add to commit body:
# [Adapted for <kernel-version>: <brief explanation of changes>]

Reproduce locally:

b4 am --single-message -C -l -3 https://lore.kernel.org/r/20260331-dma-buf-heaps-as-modules-v4-1-e18fda504419@kernel.org

Failure 2: Commit 2 - Content mismatch

Commit: 5e85b50828b6 - "FROMGIT: dma-buf: heaps: cma: Create CMA heap for each CMA reserved region"

Failure details:

Checking commit: FROMGIT: dma-buf: heaps: cma: Create CMA heap for each CMA reserved region
Change is different from the one mentioned in Link

Link in commit: https://lore.kernel.org/r/20251013-dma-buf-ecc-heap-v8-5-04ce150ea3d9@kernel.org

Analysis: Same issue as commit 1 - the patch content differs from the upstream version.

Fix: Same procedure as Failure 1 above.

Reproduce locally:

b4 am --single-message -C -l -3 https://lore.kernel.org/r/20251013-dma-buf-ecc-heap-v8-5-04ce150ea3d9@kernel.org

Failure 3: Commit 3 - Invalid prefix

Commit: fc8e99c6599a - "QCLINUX: qcom.config: Enable DMA_CMA for DMA-BUF heap support"

Failure details:

Checking commit: QCLINUX: qcom.config: Enable DMA_CMA for DMA-BUF heap support
Commit summary does not start with a required prefix

Root cause: The QCLINUX: prefix is not in the allowed list for check-patch-compliance. The checker only accepts: FROMLIST:, FROMGIT:, UPSTREAM:, BACKPORT:.

Analysis: This is a known limitation of the checker. QCLINUX: is a valid vendor-internal prefix used in the Qualcomm Linux tree for vendor-only changes with no upstream equivalent. However, check-patch-compliance enforces upstream-linkable prefixes only.

Options:

  1. If this change has been posted upstream: Change prefix to FROMLIST: and add a Link: tag pointing to the lore.kernel.org URL.

  2. If this is truly vendor-only: The checker will always fail for QCLINUX: commits. This is expected behavior. The commit already has a Link tag pointing to the internal PR (https://github.com/qualcomm-linux/kernel-topics/pull/1452), which is appropriate for vendor-only changes.

Recommendation: Accept this failure as expected for vendor-only commits. The commit is properly formatted with a Link tag to the internal topic PR.


⚠️ tag-check (Manual Check Required)

Status: Cannot be performed automatically due to network restrictions preventing GitHub API access.

What needs to be checked: If the PR target branch is not qcom-next or qcom-next-staging, then every commit subject must start with a valid prefix tag.

Valid prefixes: FROMLIST:, FROMGIT:, UPSTREAM:, BACKPORT:, QCLINUX:, PENDING:, WORKAROUND:

Current commit prefixes:

  1. FROMGIT: - dma: contiguous: Turn heap registration logic around
  2. FROMGIT: - dma-buf: heaps: cma: Create CMA heap for each CMA reserved region
  3. QCLINUX: - qcom.config: Enable DMA_CMA for DMA-BUF heap support

Verdict: All three commits have valid prefix tags. If the target branch is not qcom-next/qcom-next-staging, this check passes.


Verdict

3 blockers to address before merge:

  1. Commit 1 content mismatch - Verify the patch matches upstream or document adaptations
  2. Commit 2 content mismatch - Verify the patch matches upstream or document adaptations
  3. Commit 3 invalid prefix - Expected failure for vendor-only QCLINUX: commits; can be accepted as-is if this is truly vendor-only

Recommendation:

  • Investigate the content mismatches in commits 1 and 2 using b4 am to fetch upstream versions
  • If differences are context-only (false positive), document this in PR comments
  • If differences are legitimate adaptations, add adaptation notes to commit messages
  • The QCLINUX: prefix failure is expected and acceptable for vendor-only changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants